use :: libc;
extern "C" {
    fn getsockopt(
        __fd: i32,
        __level: i32,
        __optname: i32,
        __optval: *mut libc::c_void,
        __optlen: *mut socklen_t,
    ) -> i32;
}
pub type __uid_t = u32;
pub type __gid_t = u32;
pub type __pid_t = i32;
pub type __socklen_t = u32;
pub type gid_t = __gid_t;
pub type uid_t = __uid_t;
pub type pid_t = __pid_t;
pub type socklen_t = __socklen_t;
#[derive(Copy, Clone)]
#[repr(C)]
pub struct ucred {
    pub pid: pid_t,
    pub uid: uid_t,
    pub gid: gid_t,
}
#[no_mangle]
pub extern "C" fn getpeereid(mut s: i32, mut uid: *mut uid_t, mut gid: *mut gid_t) -> i32 {
    let mut uc: ucred = ucred {
        pid: 0,
        uid: 0,
        gid: 0,
    };
    let mut len: i32 = ::core::mem::size_of::<ucred>() as u64 as i32;
    if (unsafe {
        getsockopt(
            s,
            1 as i32,
            17 as i32,
            &mut uc as *mut ucred as *mut libc::c_void,
            &mut len as *mut i32 as *mut socklen_t,
        )
    }) == -(1 as i32)
    {
        return -(1 as i32);
    }
    (unsafe { *uid = uc.uid });
    (unsafe { *gid = uc.gid });
    return 0 as i32;
}
